/**
 * Created by liujiangyong on 2025/01/14.
 */
'use strict';

const OpenApi = require('@alicloud/openapi-client');
const Facebody = require('@alicloud/facebody20191230');

function createClient(opts) {
    let config = new OpenApi.Config();
    config.accessKeyId = opts.accessKeyId;
    config.accessKeySecret = opts.accessKeySecret;
    // Endpoint 请参考 https://api.aliyun.com/product/facebody
    config.endpoint = 'facebody.cn-shanghai.aliyuncs.com'; 
    return new Facebody.default(config);
};

module.exports = {
    entry: (app, router, opts) => {
        let facebodyClient = createClient(opts);
        app.fs = app.fs || {};
        app.fs.facebodyClient = facebodyClient;
        console.info('阿里云视觉智能开放平台 facebody 初始化完成');
    }
};